<template>
  <div id="main">
    <MdEditor class="editor" v-model="value" @onChange="handleChange" />
  </div>
</template>

<script setup lang="ts">
import { ref, withDefaults, defineProps, shallowRef } from 'vue'

import { MdEditor } from 'md-editor-v3'
import 'md-editor-v3/lib/style.css'

/**
 * 定义组件属性类型
 */
interface Props {
  value: string
  mode?: string
  handleChange: (v: string) => void
}
let emit = defineEmits(['update:value', 'update:value', 'update'])
/**
 * 给组件指定初始值
 */
const props = withDefaults(defineProps<Props>(), {
  value: '',
  mode: 'split',
  handleChange: (v: string) => {
    console.log(v)
  },
})
</script>

<style scoped lang="scss">
.editor {
  min-width: 600px;
  width: 100%;
  min-height: 300px;
}

.bytemd-toolbar-icon.bytemd-tippy.bytemd-tippy-right:last-child {
  display: none;
}
</style>
